<?php $this->load->view('admin/tab/link_bar'); ?>

<form method="post" action="<?php echo base_url() ?>admin/tab/delete" class="form">

    <div class="box_function">
        <table width="747" border="0" cellpadding="0" cellspacing="0" class="listproduct" id="listproduct">
            <tr>
                <td class="tilte_list_pro">
                    <input name="checkme" class="noborder" onclick="checkDelBoxes(this.form, 'categoryBox[]', this.checked)" type="checkbox">
                </td>
                <td class="tilte_list_pro">
						ID<br>
                    <a href="#"><img src="<?php echo base_url() ?>images/admin/down.gif" border="0"></a>
                    <a href="#"><img src="<?php echo base_url() ?>images/admin/up.gif" border="0"></a>
                </td>
                <td class="tilte_list_pro">
						Name<br>
                    <a href=""><img src="<?php echo base_url() ?>/images/admin/down.gif" border="0"></a>
                    <a href=""><img src="<?php echo base_url() ?>images/admin/up_d.gif" border="0"></a>
                </td>
                <td class="tilte_list_pro">
						Icon
                </td>
                <td class="tilte_list_pro">
						Parent
                </td>
                <td class="tilte_list_pro">
						Position
                </td>
                <td class="tilte_list_pro" style="width: 80px;">
						Actions
                </td>
            </tr>
            <?php
            if (count($rows) > 0) {
                for ($i = 0; $i < count($rows); $i++) {
                    $id = $rows[$i]->id_tab;
                    $name = $rows[$i]->vi_name;
                    $parent_name = $rows[$i]->parent_name;
                    $position = $rows[$i]->position;
                    $min_position = $rows[$i]->min_position;
                    $max_position = $rows[$i]->max_position;
                    $num_child = $rows[$i]->num_child;
                    $id_parent = $rows[$i]->id_parent_tab;
                    $icon = $rows[$i]->icon;

                    if ($i % 2 == 0)
                        $css_class = 'row1';
                    else
                        $css_class = 'row2';
            ?>
                    <tr onMouseOver="" class="<?php echo $css_class ?>">
                        <td class="product center">
                            <input name="categoryBox[]" value="<?php echo $id ?>" class="noborder" type="checkbox"></td>
                <td class="pointer center" onclick="document.location = '#'">
<?php echo $id ?>
                </td>

                <td class="pointer" onclick="document.location = '#'">
                    <?php
                    if ($num_child)
                        echo '<a href="' . site_url('admin/tab/view/' . $id) . '">' . $name . '</a>';
                    else
                        echo $name;
                    ?>
                </td>
                <td class="pointer" onclick="document.location = '#'">
                    <?php if (file_exists($icon))
                        echo '<img src="' . base_url() . $icon . '" width=16 height=16>' ?>
                    </td>
                    <td class="pointer" onclick="document.location = '#'">
<?php echo $parent_name ?>
                    </td>
                    <td class="pointer center" onclick="document.location = '#'">
                    <?php if ($position < $max_position AND isset($rows[$i + 1])) {
 ?>
                            <a href="<?php echo site_url('admin/tab/change_position/'. $id . '/' . $rows[$i + 1]->id_tab) ?>">
                                <img src="<?php echo base_url() ?>images/admin/down.gif" alt="Up" title="Up" border="0">
                            </a>
<?php
                        }
                        if ($position > $min_position AND isset($rows[$i - 1])) {
?>
                            <a href="<?php echo site_url('admin/tab/change_position/'.$id . '/' . $rows[$i - 1]->id_tab) ?>">
                                <img src="<?php echo base_url() ?>images/admin/up.gif" alt="Down" title="Down" border="0">
                            </a>
<?php } ?>

                    </td>
                    <td class="center">
                        <a href="<?php echo site_url('admin/tab/view/'.$id) ?>">
                            <img src="<?php echo base_url() ?>/images/admin/details.gif" alt="View" title="View" border="0">
                        </a>
                        <a href="<?php echo site_url('admin/tab/edit/'.$id) ?>">
                            <img src="<?php echo base_url() ?>images/admin/edit.gif" alt="Edit" title="Edit" border="0">
                        </a>

                        <a href="<?php echo site_url('admin/tab/delete/'.$id) ?>" onclick="return confirm('Delete item #<?php echo $id ?>?');">
                                    <img src="<?php echo base_url() ?>images/admin/delete.gif" alt="Delete" title="Delete" border="0">
                                </a>
                            </td>
                        </tr>
<?php
                    }
                }
?>

                <tr>
                    <td colspan="5">

                        <p>
                            <input class="button" name="submitDelcategory" value="Delete selection" onclick="return confirm('Delete selected items?');" type="submit">
                        </p>

                    </td>
                </tr>
            </table>
        </div>
    </form>
<?php echo $this->pagination->create_links(); ?>